package com.hanthink.web.controller.app.selfcheck;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.hanthink.common.constant.HttpStatus;
import com.hanthink.common.core.controller.BaseController;
import com.hanthink.common.core.page.TableDataInfo;
import com.hanthink.system.domain.selfcheck.SelfCheckInfo;
import com.hanthink.system.service.selfcheck.ICheckInfoService;

@RestController
@RequestMapping("/app/selfcheck/checkInfo")
public class SelfCheckInfoControll extends BaseController {

	@Autowired
	private ICheckInfoService checkInfoService;

	// 查询未审核数据
	@PostMapping("/listNotCheck")
	public TableDataInfo listNotCheck(@RequestBody SelfCheckInfo info) {
		startPage();
		List<SelfCheckInfo> list = checkInfoService.selectNotCheckList(info);
		return getDataTable(list);
	}

	// 查询已审核数据
	@PostMapping("/listChecked")
	public TableDataInfo listChecked(@RequestBody SelfCheckInfo info) {
		startPage();
		List<SelfCheckInfo> list = checkInfoService.selectCheckedList(info);
		return getDataTable(list);
	}

	// 更新审核成功数据
	@PostMapping("/updateSuccess")
	public TableDataInfo updateSuccess(@RequestBody List<SelfCheckInfo> info) {
		checkInfoService.updateCheckListSuccess(info);
		TableDataInfo rspData = new TableDataInfo();
		rspData.setCode(HttpStatus.SUCCESS);
		rspData.setMsg("操作成功");
		return rspData;
	}

	// 更新审核失败数据
	@PostMapping("/updateFail")
	public TableDataInfo updateFail(@RequestBody List<SelfCheckInfo> info) {
		checkInfoService.updateCheckListFail(info);
		TableDataInfo rspData = new TableDataInfo();
		rspData.setCode(HttpStatus.SUCCESS);
		rspData.setMsg("操作成功");
		return rspData;
	}
}
